package com.health.inquiry.server.service.impl;

import com.health.inquiry.common.domain.DmsFans;
import com.health.inquiry.common.domain.vo.DmsFansVo;
import com.health.common.security.utils.SecurityUtils;
import com.health.inquiry.server.service.FansService;
import com.health.inquiry.server.mapper.FansMapper;
import com.health.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class FansServiceImpl implements FansService {
    @Autowired
    private FansMapper fansMapper;
    @Override
    public List<DmsFansVo> selectFansList() {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        Long userid = loginUser.getUserid();
        List<DmsFansVo> vos = fansMapper.selectFansList(userid);
        return vos;
    }

    @Override
    public void addFans(DmsFans dmsFans) {
        //LoginUser loginUser = SecurityUtils.getLoginUser();
        //Long userid = loginUser.getUserid();
        dmsFans.setPatientId(2L);
        dmsFans.setCreateTime(new Date());
        fansMapper.addFans(dmsFans);
    }
}
